package com.xinqi.modules.stats.studyanalysis.controller.app;

import com.xinqi.common.base.response.R;
import com.xinqi.modules.stats.studyanalysis.dto.req.StudentAnalysisQueryDTO;
import com.xinqi.modules.stats.studyanalysis.dto.req.StudentInfoAnalysisQueryDTO;
import com.xinqi.modules.stats.studyanalysis.dto.rsp.StudyAnalysisVo;
import com.xinqi.modules.stats.studyanalysis.service.StudyAnalysisService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 学勤分析app
 *
 * @author: 星星
 * @date: 2023/03/26
 */
@RestController
@RequestMapping("/app/studyanalysis")
@RequiredArgsConstructor
public class StudyAnalysisAppController {
    private final StudyAnalysisService studyAnalysisService;

    /**
     * 整体分析
     *
     * @Author 星星
     * @Date 15:02 2023/3/22
     * @Return
     * @Exception
     */
    @GetMapping("/wholeAnalysis/{classId}")
    public R wholeAnalysis(@PathVariable("classId") Long classId) {
        List<StudyAnalysisVo> res = studyAnalysisService.wholeAnalysis(classId);
        return R.ok(res);
    }

    /**
     * 学生整体分析
     *
     * @Author 星星
     * @Date 15:02 2023/3/22
     * @Return
     * @Exception
     */
    @GetMapping("/studentAnalysis")
    public R studentAnalysis(@Validated StudentAnalysisQueryDTO analysisQueryDTO) {
        Map<String, Object> res = studyAnalysisService.studentAnalysis(analysisQueryDTO);
        return R.ok(res);
    }

    /**
     * 学生详情分析
     *
     * @Author 星星
     * @Date 15:02 2023/3/27
     * @Return
     * @Exception
     */
    @GetMapping("/studentInfoAnalysis")
    public R studentInfoAnalysis(@Validated StudentInfoAnalysisQueryDTO analysisQueryDTO) {
        Map<String, Object> res = studyAnalysisService.studentInfoAnalysis(analysisQueryDTO);
        return R.ok(res);
    }
}
